import request from "@/utils/request";

const {
  get: $get,
  post: $post,
  delete: $delete,
  download: $download,
  post_query: $post_query,
} = request;

// // 流程启动接口
// export const startProcess = (data) => {
//   return $post("/activiti/activiti/monitor/startProcess", data);
// };

/**
 * 流程启动接口
 * @param { import("@/types/StartExtendArgsDTO").StartExtendArgsDTO } p
 */
export const startProcess = (p) =>
  request.post(`/activiti/activiti/monitor/startProcess`, p);

// 流程实例列表
export const listProcess = (data) => {
  return $post_query("/activiti/activiti/monitor/listProcess", data);
};

/** 根据业务信息获取关联流程信息
 * @param { { module:string, businessKey:string } } p
 * @description
 * module 业务单据不能为空
 * businessKey 业务数据id不能为空
 *
 * @returns { Promise< import("axios").AxiosResponse<
 *  import("@/types/InstanceBusiness").InstanceBusiness,
 *  import("@/types/InstanceBusiness").InstanceBusiness,
 * > > }
 */
export const getInstanceBusiness = async (p) =>
  request.post_query(`/activiti/activiti/monitor/getInstanceBusiness`, p);

/**
 * 获取 审批历史列表
 * @param { import("@/types/HistoricActivity").HistoricActivity } p
 *
 * @returns { Promise< import("axios").AxiosResponse<
 *  import("@/types/HistoricActivity").HistoricActivity[],
 *  import("@/types/HistoricActivity").HistoricActivity[],
 * > > }
 *
 */
export const getListHistory = (p) =>
  request.post(`/activiti/activiti/monitor/listHistory`, p);
